package tcp;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.Socket;

/**
 * @author Mark
 * @version 1.0
 * @date 2020/5/17 17:25
 * @description tcp客户端
 */
public class TcpClient {
    public static void main(String[] args) {
        try {
            InetAddress byName = Inet4Address.getByName("127.0.0.1");
            int port = 9999;
            Socket socket = new Socket(byName, port);
            OutputStream outputStream = socket.getOutputStream();
            outputStream.write("你好".getBytes());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
